<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller {
  protected $layout = 'layout';
  protected $stylesheets = array(
  );
  protected $javascripts = array(
  );

  protected function render($content, $layout = 'layout') {
    if (is_string($layout)) {
        $this->layout = $layout;
    }
    $view_data = array(
      'content' => $content,
      'stylesheets' => $this->stylesheets,
      'javascripts' => $this->javascripts
    );
    $this->load->view($this->layout, $view_data);
  }

  protected function set_stylesheets($stylesheets = array()) {
    if (!is_array($stylesheets)) {
      $stylesheets = array($stylesheets);
    }
    $this->stylesheets = $stylesheets;
  }

  protected function set_javascripts($javascripts = array()) {
    if (!is_array($javascripts)) {
      $javascripts = array($javascripts);
    }
    $this->javascripts = $javascripts;
  }
}